'use strict';

module.exports = app => {
  const { STRING, UUID, NOW, DATE, UUIDV4, INTEGER } = app.Sequelize;

  const unusualLogs = app.model.define('unusualLogs', {
    id: {
      type: UUID,
      primaryKey: true,
      allowNull: false,
      defaultValue: UUIDV4,
    },
    partnerId: {
      type: STRING(36),
      field: 'partner_id',
      comment: '设备ip'
    },
    monitorNumsUnusualDate: {
      type: DATE,
      field: 'monitor_nums_unusual_date',
      comment: '滞留车辆数异常发生时间'
    },
    monitorSecondsDate: {
      type: DATE,
      field: 'monitor_seconds_date',
      comment: '理论行驶时间异常发生时间'
    },
    status: {
      type: INTEGER,
      field: 'status',
      comment: '1、设防中，2、滞留车辆数预警，3、滞留时间预警，4，警报中，5，排查中，6，停止工作'
    },
    inNums: {
      type: INTEGER,
      field: 'in_nums',
      comment: '入口车辆数量'
    },
    outNums: {
      type: INTEGER,
      field: 'out_nums',
      comment: '出口口车辆数量'
    },
    createDate: {
      type: DATE,
      defaultValue: NOW,
      field: 'create_date',
      comment: '创建时间'
    },
  }, {
    timestamps: false,
    // 实例对应的表名    
    tableName: 'unusual_logs',
  });

  return unusualLogs;

};